package com.cyd.springbootweb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringbootWebApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootWebApplication.class, args);
        String port = context.getEnvironment().getProperty("server.port");
        String contentPath = context.getEnvironment().getProperty("server.context-path");
        // 直接访问静态资源
        System.out.println("http://localhost:" + port + contentPath + "/images/img.png");
        // 访问公共资源
        System.out.println("http://localhost:" + port + contentPath + "/hello.html");
        // 直接访问模板（无法访问）
        System.out.println("http://localhost:" + port + contentPath + "/index.html");
        // 通过控制器转发
        System.out.println("http://localhost:" + port + contentPath + "/demo/index");
        // 通过控制器转发
        System.out.println("http://localhost:" + port + contentPath + "/demo/hello");
        // 测试thy传输对象和模板
        System.out.println("http://localhost:" + port + contentPath + "/person/get");
    }
}
